package com.qax.scheduler.spring.boot.autoconfigure.repository;

import com.qax.scheduler.spring.boot.autoconfigure.entity.UploadJobInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

@Transactional
public interface JobRepository  extends JpaRepository<UploadJobInfo, String> {

    @Modifying
    @Query(value="update UploadJobInfo o" +
            " set o.jobStatus=:nn ," +
            " o.updateTime =:date  where o.jobId =:jobId")
    int updateJobStatusInfoByJobId(@Param("nn") Byte jobStatus,
                                   @Param("jobId") String jobId,
                                   @Param("date") Date date);
}
